<?php

//var_dump($_POST);
$name = $_POST["name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$website = $_POST["website"];
$msg = $_POST["msg"];

require 'PHPMailerAutoload.php';
$body = '
    <html>
        <head>     
            <meta charset="UTF-8" />
            <meta name="language" content="vi" />
        </head>
        <body>
            <div style=" border:1px solid #dfdfdf;border-radius:5px;padding:10px;text-align:left;">
                <h3> Information </h3>
                <div>
                    <h4>Name: ' . $name . ' </h4>
                    <h4>Email: ' . $email . '</h4>
                    <h4>Phone: ' . $phone . '</h4> 
                    <h4>Website: ' . $website . '</h4>
                    <h4>Message: </h4>
                </div>
                <div>' .$msg . '</div>
            </div>
        </body>
    </html>
    ';

//Create a new PHPMailer instance
$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "aquilamediagroup@gmail.com"; // SMTP username
$mail->Password = "Duybmt2012"; // SMTP password
$mail->From = $email;
$mail->FromName = "Webmaster";
//$mail->SMTPDebug = 2;
//$mail->Debugoutput = 'html';
//$mail->setFrom('webmaster@aquila.com', 'Admin');
$mail->addAddress("aquilamediagroup@gmail.com");
$mail->Subject = "Information of $name";
$mail->WordWrap = 50;
$mail->isHTML(true);
$mail->SMTPSecure = 'ssl'; 

$mail->Body    = $body;

//send the message, check for errors
if (!$mail->send()) {
    //echo "Mailer Error: " . $mail->ErrorInfo;
    exit(json_encode(array('status' => 0,'mess' => $mail->ErrorInfo)));
} else {
    //echo "Message sent!";
    exit(json_encode(array('status' => 1,'mess' => "Succesfully")));
}



?>